import { createStore } from 'vuex'
import axios from 'axios';

export default createStore({
  state: {
    name:'guoguo'
  },
  mutations: {
    changeName(state, str){
      state.name = str;
    }
  },
  actions: {
    getData(store){
      axios.get('https://autumnfish.cn/search?keywords=%E4%B8%83%E9%87%8C%E9%A6%99')
        .then((response) => {
          console.log(response);
          store.commit('changeName', response.data.result.songs[0].name);
        });
    }
  },
  modules: {
  }
})
